# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.

cmake_minimum_required(VERSION 3.4.1)

# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add.library() commands,
# and CMake builds them for you. When you build your app, Gradle
# automatically packages shared libraries with your APK.

# Specifies a path to native header files.

include_directories(src/main/cpp/preinclude/)

## 设置目标链接库
add_library( # Specifies the name of the library.
             calcsub-lib
             # Sets the library as a shared library.
             SHARED
             # Provides a relative path to your source file(s).
             src/main/cpp/calcsub-lib.cpp )

## Android 自带库
find_library( # Sets the name of the path variable.
               log-lib
               # Specifies the name of the NDK library that
               # you want CMake to locate.
               log )

add_library(calc-natvice-lib
            SHARED
            IMPORTED)

set_target_properties( # Specifies the target library.
                        calc-natvice-lib
                        # Specifies the parameter you want to define.
                        PROPERTIES IMPORTED_LOCATION

                        # Provides the path to the library you want to import.
                        src/main/cpp/prebuilt/${ANDROID_ABI}/libcalc-native-lib.so
                        )

target_link_libraries( # Specifies the target library.
                      calcsub-lib
                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib}
                       ${calc-natvice-lib}
                        )